package meterMonitor.constand;

import java.util.HashMap;
import java.util.Map;

public enum JsonFormatType {
	    JACKSON(10L,"jackson"),
	    GSON(20L,"gson");
	    
	    private Long code;
	    private String desciption;
	    
	    private JsonFormatType(Long code,String desciption){
	        this.code = code;
	        this.desciption = desciption;
	    }

	    

	    public Long getCode() {
	        return code;
	    }



	    public void setCode(Long code) {
	        this.code = code;
	    }



	    public String getDesciption() {
	        return desciption;
	    }

	    public void setDesciption(String desciption) {
	        this.desciption = desciption;
	    }


	    public static Map<Long,String> getEnumMap(){
	    	Map<Long,String> map = new HashMap<>();
	    	JsonFormatType[] values =  values();
	    	for (JsonFormatType item : values) {
				map.put(item.code, item.desciption);
			}
	    	return map;
	    }
	    
//	    public static Investor getByCode(Long code){
//	    	Investor[] values =  values();
//	        for (Investor item : values)
//	        {
//	            if(item.getCode().equals(code)){
//	                return item;
//	            }
//	        }
//	        return null;
//	    }

	    /**
	     * 
	    * @Title: getDescriptionByCode 
	    * @Description: TODO(得到code对应的中文注释) 
	    * @param @param code
	    * @param @return    设定文件 
	    * @return String    返回类型 
	    * @author shuai.zhu shuai.zhu@china.zhaogang.com 
	    * @throws
	     */
	     public static String getDescriptionByCode(Long code){
	    	 JsonFormatType[] values =  values();
	         for (JsonFormatType item : values)
	         {
	             if(item.getCode().equals(code)){
	                 return item.getDesciption();
	             }
	         }
	         return "";
	     }
}
